class Listener(object):
    """ Consumer of rabbitmq
    connect to rabbitmq and receive message from it
    refer to http://pika.readthedocs.io/en/0.10.0/examples/tornado_consumer.html
    """
    def __init__(self, callback):
        self.callback = callback
        # ...
        self.connect()

    def connect(self):
        self._connection = adapters.TornadoConnection(pika.URLParameters(self._url),
                                          self.on_connection_open)

    def on_connection_open(self, unused_connection):
        pass

    # ...

    def on_message(self, unused_channel, basic_deliver, properties, body):
        # ...
        self.handle_message(body)

    def handle_message(self, msg):
        """handle message when receive one
        """
        self.callback(msg)